rm(list = ls())

library(tidyverse)

## Load data

rile_btw <- readRDS('data/data_for_rile_polar.rds') %>%
  filter(year >= 1980 & year <= 2009) %>%
  mutate(party = fct_relevel(party, 'fdp', 'cdu_csu', 'spd', 'greens', 'left')) %>%
  mutate(party_label = recode(party, 
                              'fdp' = 'FDP',
                              'cdu_csu' = 'CDU/CSU',
                              'spd' = 'SPD',
                              'greens' = 'Greens', 
                              'left' = 'Left party')) 
## 

p1 <- ggplot(rile_btw, aes(x = rile - p_sys_avg_bund, y = party_label)) +
  geom_vline(xintercept = 0, linetype = 'dotted') +
  geom_point(size = 2) + 
  facet_wrap(~ year) +
  theme_bw() + 
  labs(x = 'Rile score (left-right position)\n(rel. to election-specific system average)',
       y = '',
       size = 'Voteshare') + 
  theme(legend.position = 'bottom') + 
  scale_x_continuous(breaks = seq(-30, 30, 10)) 

p1

